package com.chaoyue.content.controller;


import com.chaoyue.content.beans.dto.BindTeachplanMediaDto;
import com.chaoyue.content.beans.dto.SaveTeachplanDto;
import com.chaoyue.content.beans.dto.TeachplanDto;
import com.chaoyue.content.service.TeachplanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@SuppressWarnings({"all"})
/**
 * @author whr
 * @version 1.0
 * @description: 课程计划接口层
 * @date 2023/12/8 20:53
 */
@Api(value = "课程计划信息管理接口", tags = "课程计划信息管理接口")
@RestController
public class TeachplanController {
    @Autowired
    TeachplanService teachplanService;

    @ApiOperation("课程计划信息查询")
    @GetMapping("/teachplan/{courseId}/tree-nodes")
    public List<TeachplanDto> getTreeNodes(@PathVariable Long courseId) {
        return teachplanService.findTeachplanTree(courseId);
    }

    @ApiOperation("新增课程计划")
    @PostMapping("/teachplan")
    public void saveTeachplan(@RequestBody SaveTeachplanDto teachplanDto) {
        teachplanService.saveTeachplan(teachplanDto);
    }

    @ApiOperation("课程计划绑定媒资信息")
    @PostMapping("/teachplan/association/media")
    public void associationMedia(@RequestBody BindTeachplanMediaDto bindTeachplanMediaDto) {
        teachplanService.associationMedia(bindTeachplanMediaDto);
    }

}
